package customerEnter.Frame.JDBCDao.daoFrame;

import java.util.List;

import customerEnter.Frame.DaoDataTransmission.DaoFrameDMLBaseTransmission;
import customerEnter.Frame.Enum.FrameDataSqlDMLUse;
import customerEnter.Frame.Enum.T_SQLConditionEnum;
import customerEnter.Frame.JDBCDao.Interface.DMLParameterSettingInterface;

public class DMLParameterSettingParameterImpl implements DMLParameterSettingInterface {
	/**
	 * 查詢統計的單個int數據
	 */
	public DaoFrameDMLBaseTransmission findQueryInteger(String front, String tableName, String where) {
		return new DaoFrameDMLBaseTransmission(front, tableName, where, Integer.class, false, false,
				FrameDataSqlDMLUse.SelectInteger);
	}

	/**
	 * 查詢object
	 */
	public DaoFrameDMLBaseTransmission findQueryBean(String front, String tableName, String where, Class<?> className,
			Boolean pagingParametersCount, boolean ifEhcache) {
		return new DaoFrameDMLBaseTransmission(front, tableName, where, className, ifEhcache, pagingParametersCount,
				FrameDataSqlDMLUse.bean);
	}

	/**
	 * 查詢object 沒有總數的查詢
	 */
	public DaoFrameDMLBaseTransmission findQueryBean(String front, String tableName, String where, Class<?> className,
			boolean ifEhcache) {
		return new DaoFrameDMLBaseTransmission(front, tableName, where, className, ifEhcache, false,
				FrameDataSqlDMLUse.bean);
	}

	/**
	 * 查詢list數據
	 */
	public DaoFrameDMLBaseTransmission findQueryList(String front, String tableName, String where, Class<?> className,
			Boolean pagingParametersCount, boolean ifEhcache) {

		return new DaoFrameDMLBaseTransmission(front, tableName, where, className, ifEhcache, pagingParametersCount,
				FrameDataSqlDMLUse.SelectList);
	}

	/**
	 * 查詢分頁時間排序類型數據
	 */
	public DaoFrameDMLBaseTransmission findQueryPageTime(String front, String tableName, String where,
			Class<?> className, Boolean pagingParametersCount, boolean ifEhcache, int size, int page, String order,
			String descOrAsc, int position) {
		return new DaoFrameDMLBaseTransmission(front, tableName, where, className, ifEhcache, pagingParametersCount,
				size, page, order, descOrAsc, position, FrameDataSqlDMLUse.selectPage);
	}

	/**
	 * 查詢分頁
	 */
	public DaoFrameDMLBaseTransmission findQueryPage(String front, String tableName, String where, Class<?> className,
			Boolean pagingParametersCount, boolean ifEhcache, int size, int page, String order, String descOrAsc) {
		return new DaoFrameDMLBaseTransmission(front, tableName, where, className, ifEhcache, pagingParametersCount,
				size, page, order, descOrAsc, FrameDataSqlDMLUse.selectPage);
	}

	@Override
	public <T> DaoFrameDMLBaseTransmission InsertBatch(String TableName, List<T> t, Class<T> class1) {
		return new DaoFrameDMLBaseTransmission(T_SQLConditionEnum.DMLinsert, "", TableName, "", t, false, "", class1,
				FrameDataSqlDMLUse.InsertBath);
	}

	@Override
	public DaoFrameDMLBaseTransmission InsterObject(String Table, Object MappingObject, boolean isReturnId) {
		return new DaoFrameDMLBaseTransmission(T_SQLConditionEnum.DMLinsert, "", Table, "", null, isReturnId,
				MappingObject, null, FrameDataSqlDMLUse.Insert);
	}

	@Override
	public <T> DaoFrameDMLBaseTransmission InsterObject(String Table, Object MappingObject) {
		return new DaoFrameDMLBaseTransmission(T_SQLConditionEnum.DMLinsert, "", Table, "", null, false, MappingObject,
				null, FrameDataSqlDMLUse.Insert);
	}

	@Override
	public DaoFrameDMLBaseTransmission updateTable(String TableName, Object MappingObject, String where) {

		return new DaoFrameDMLBaseTransmission(T_SQLConditionEnum.DMLUpdate, "", TableName, where, null, false,
				MappingObject, null, FrameDataSqlDMLUse.Update);
	}

	@Override
	public <T> DaoFrameDMLBaseTransmission updateTableBatch(String TableName, List<T> t, String where) {
		// TODO Auto-generated method stub
		return new DaoFrameDMLBaseTransmission(T_SQLConditionEnum.DMLUpdate, "", TableName, where, t, false, null,
				null, FrameDataSqlDMLUse.UpdateBath);
	}

	@Override
	public DaoFrameDMLBaseTransmission delete(String TableName, String where) {
		return new DaoFrameDMLBaseTransmission(T_SQLConditionEnum.DMLdelete, "", TableName, where, null, false, null,
				null, FrameDataSqlDMLUse.delete);
	}

	@Override
	public DaoFrameDMLBaseTransmission savePreparedStatementReturnId(String Table, Object[] objects) {
		return new DaoFrameDMLBaseTransmission(T_SQLConditionEnum.DMLinsert, null, Table, null, true, objects, null,
				FrameDataSqlDMLUse.Insert);
	}

	@Override
	public DaoFrameDMLBaseTransmission UpdatePreparedStatement(String TableName, String where, Object[] objects) {

		return new DaoFrameDMLBaseTransmission(T_SQLConditionEnum.DMLUpdate, null, TableName, where, false, objects,
				null, FrameDataSqlDMLUse.Update);
	}

	@Override
	public DaoFrameDMLBaseTransmission savePreparedStatementBatch(String Table, List<Object[]> objects) {
		return new DaoFrameDMLBaseTransmission(T_SQLConditionEnum.DMLinsert, null, Table, null, false, null, objects,
				FrameDataSqlDMLUse.InsertBath);
	}

	@Override
	public DaoFrameDMLBaseTransmission UpdatePreparedStatementBatch(String TableName, String where,
			List<Object[]> objects) {
		return new DaoFrameDMLBaseTransmission(T_SQLConditionEnum.DMLUpdate, null, TableName, where, false, null,
				objects, FrameDataSqlDMLUse.UpdateBath);
	}

	@Override
	public DaoFrameDMLBaseTransmission findQueryString(String front, String tableName, String where, boolean ifEhcache) {
		// TODO Auto-generated method stub
		return new DaoFrameDMLBaseTransmission(front, tableName, where, null, ifEhcache, false,
				FrameDataSqlDMLUse.SelectString);
	}

	@Override
	public DaoFrameDMLBaseTransmission findQueryListObjects(String front, String tableName, String where,
			boolean ifEhcache) {
		// TODO Auto-generated method stub
		return new DaoFrameDMLBaseTransmission(front, tableName, where, null, ifEhcache, false,
				FrameDataSqlDMLUse.SelectListObjects);
	}

	@Override
	public DaoFrameDMLBaseTransmission findQueryMap(String front, String tableName, String where, boolean ifEhcache) {
		// TODO Auto-generated method stub
		return new DaoFrameDMLBaseTransmission(front, tableName, where, null, ifEhcache, false,
				FrameDataSqlDMLUse.SelectMap);
	}

	@Override
	public DaoFrameDMLBaseTransmission findQueryListMap(String front, String tableName, String where, boolean ifEhcache) {
		return new DaoFrameDMLBaseTransmission(front, tableName, where, null, ifEhcache, false,
				FrameDataSqlDMLUse.SelectListMap);
	}

	@Override
	public DaoFrameDMLBaseTransmission findQueryListPageMap(String front, String tableName, String where,
			Class<?> className, Boolean pagingParametersCount, boolean ifEhcache, int size, int page, String order,
			String descOrAsc, int position) {
		// TODO Auto-generated method stub
		return new DaoFrameDMLBaseTransmission(front, tableName, where, className, ifEhcache, pagingParametersCount,
				size, page, order, descOrAsc, position, FrameDataSqlDMLUse.SelectListPageMap);
	}

	public DaoFrameDMLBaseTransmission findQueryOneOrMayList(String front, String tableName, String where,
			Class<?> className, Boolean pagingParametersCount, boolean ifEhcache) {
		return new DaoFrameDMLBaseTransmission(front, tableName, where, className, ifEhcache, pagingParametersCount,
				FrameDataSqlDMLUse.SelectMayAndOne);
	}

}
